package com.spic.business.alarm.controller;

import com.spic.business.alarm.domain.FireAlarm;
import com.spic.business.alarm.service.FireAlarmService;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import com.spic.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * WindDamageController
 *
 * @author xuxiaochang@chinasofi.com
 * @date 2022/3/17
 */
@RestController
@RequestMapping("/fireAlarm")
public class FireAlarmController extends BaseController {
    @Autowired
    private FireAlarmService fireAlarmService;

    /**
     * 火点检测 192515
     * 烟火检测 192514
     *
     * @param fireAlarm
     * @return
     */
    @GetMapping("/listFire")
    public TableDataInfo list(FireAlarm fireAlarm) {
        startPage();
        List<FireAlarm> list = fireAlarmService.selectFireAlarmList1(fireAlarm);
        return getDataTable(list);
    }

    /**
     * 烟雾检测 192513
     *
     * @param fireAlarm
     * @return
     */
    @GetMapping("/listSmoke")
    public TableDataInfo list2(FireAlarm fireAlarm) {
        startPage();
        List<FireAlarm> list = fireAlarmService.selectFireAlarmList2(fireAlarm);
        return getDataTable(list);
    }


    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(fireAlarmService.selectFireAlarmById(id));
    }

}
